@font-face {
  font-family: 'Nasalization V2';
  src: url('./Nasalization%20V2.woff2') format('woff2'),
       url('./Nasalization%20V2.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* Basis */
body {
  margin: 0;
  overflow: hidden;
  background-color: #000;
  font-family: 'Nasalization V2', system-ui, -apple-system, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  user-drag: none;
  -webkit-font-smoothing: antialiased;
}
canvas { display: block; position: absolute; top: 0; left: 0; touch-action: none; }
#label-container { position: absolute; inset: 0; pointer-events: none; }

/* Labels */
.label {
  color: #fff;
  font-family: 'Nasalization V2', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  text-shadow: 0 0 5px #ffffff;
  white-space: normal;
  word-break: break-word;
  max-width: 220px;
  text-align: center;
  transform: translateY(-16px);
  transform-origin: center bottom;
}
.label-line {
  width: 1px; height: 52px;
  background: linear-gradient(to bottom, rgba(255,255,255,0.85), rgba(255,255,255,0));
  margin: 8px auto 0;
}

/* UI Fades */
#info, #joystick-zone, #bottom-bar { opacity: 0; pointer-events: none; transition: opacity 1s ease-out; }
#info.ui-visible, #joystick-zone.ui-visible, #bottom-bar.ui-visible { opacity: 1; pointer-events: auto; }

#info {
  position: absolute; top: 10px; width: 100%; text-align: center;
  color: rgba(255,255,255,0.8); font-size: clamp(10px, 2.5vw, 14px);
  text-shadow: 2px 2px 4px #000; z-index: 10;
  padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left);
}

#joystick-zone {
  position: absolute; bottom: calc(20px + env(safe-area-inset-bottom)); left: 20px;
  width: 160px; height: 160px; background: rgba(30,30,30,0.5);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 50%; z-index: 20;
}

/* Liquid Glass */
.liquid-glass {
  position: relative;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 24px;
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  overflow: hidden;
}
.liquid-glass::before {
  content: "";
  position: absolute; inset: -20%;
  background: radial-gradient(60% 40% at var(--lg-x, 50%) var(--lg-y, 50%),
    rgba(255,255,255,0.35), rgba(255,255,255,0.12) 35%, rgba(255,255,255,0) 60%);
  mix-blend-mode: screen;
  filter: blur(12px);
  opacity: 0.9;
  animation: lgDrift 8s ease-in-out infinite alternate;
  pointer-events: none;
}
.liquid-glass::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(1px 1px at 25% 20%, rgba(255,255,255,0.05), transparent 50%),
    radial-gradient(1px 1px at 60% 70%, rgba(255,255,255,0.05), transparent 50%),
    radial-gradient(1px 1px at 80% 30%, rgba(255,255,255,0.04), transparent 50%);
  opacity: .9;
  pointer-events: none;
}
@keyframes lgDrift {
  from { transform: translate3d(-2%, -1%, 0) scale(1.02); }
  to   { transform: translate3d(2%, 1%, 0)  scale(1.05); }
}

/* Bottom Bar */
#bottom-bar {
  position: absolute; bottom: calc(20px + env(safe-area-inset-bottom)); right: 20px; height: 90px;
  border-radius: 25px;
  display: flex; align-items: center; justify-content: flex-end;
  padding: 0 16px; gap: 10px; box-sizing: border-box; z-index: 15;
}
#bottom-bar.liquid-glass { border-radius: 25px; }

/* Buttons */
#mute-button, #analyze-button, #motion-toggle-button { position: relative; top: 0; right: 0; }

#mute-button {
  width: 48px; height: 48px; background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 16px;
  cursor: pointer; padding: 12px; transition: background-color .2s ease; color: #fff;
}
#mute-button svg { width: 100%; height: 100%; }
#speaker-icon { fill: white; }
#mute-slash { fill: none; stroke: white; stroke-width: 2.5; stroke-linecap: round; opacity: 0; transform-origin: center; transform: scale(0.8); transition: opacity .3s ease, transform .3s ease; }
#mute-button.muted #mute-slash { opacity: 1; transform: scale(1); }

#analyze-button, #motion-toggle-button {
  padding: 12px 20px; background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.1); color: white; font-size: 16px;
  cursor: pointer; border-radius: 50px;
  opacity: 0; pointer-events: none;
  transition: opacity .5s ease, background-color .2s ease, color .2s ease, box-shadow .2s ease;
}
#analyze-button.ui-visible, #motion-toggle-button.ui-visible { opacity: 1; pointer-events: auto; }
#mute-button:hover, #analyze-button:hover, #motion-toggle-button:hover { background-color: rgba(255,255,255,0.1); }

/* Gyro icon size */
#motion-toggle-button .gyro-icon { width: 24px; height: 24px; display: block; }

/* Motion Toggle aktiv (voll opak + Glow) */
#motion-toggle-button.active {
  background: rgba(255,255,255,1);
  color: #111;
  box-shadow: 0 0 18px rgba(255,255,255,0.9), 0 0 32px rgba(255,255,255,0.6);
}

/* Analyze-Button Outline-Glow */
#analyze-button.btn-outline-glow {
  position: relative; isolation: isolate; overflow: visible;
}
#analyze-button.btn-outline-glow::after {
  content: ""; position: absolute; inset: -8px; border: 2px solid rgba(255,255,255,0.9);
  border-radius: inherit; box-shadow: 0 0 12px rgba(255,255,255,0.9), 0 0 24px rgba(255,255,255,0.6);
  pointer-events: none; opacity: 1; animation: btnPulse 1.4s ease-in-out infinite;
}
@keyframes btnPulse {
  0% { transform: scale(0.98); opacity: 1; }
  60% { transform: scale(1.04); opacity: 0.55; }
  100% { transform: scale(0.98); opacity: 1; }
}

/* Pointer Glow */
.pointer-glow { position: relative; touch-action: manipulation; }
.pointer-glow::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(120px 120px at var(--glow-x, -120px) var(--glow-y, -120px),
    rgba(255,255,255,0.28), rgba(255,255,255,0) 60%);
  opacity: 0; transition: opacity .18s ease; pointer-events: none;
}
.pointer-glow:hover::before, .pointer-glow.hover-active::before { opacity: 1; }
.pointer-glow.touch-hover::before {
  background: radial-gradient(220px 220px at var(--glow-x, -220px) var(--glow-y, -220px),
    rgba(255,255,255,0.55), rgba(255,255,255,0) 60%);
}

/* Ladebildschirm */
#loading-screen {
  position: absolute; inset: 0; background: rgba(0,0,0,0.3);
  display: flex; justify-content: center; align-items: center;
  z-index: 100; transition: opacity .5s ease; cursor: default;
}
#loading-screen.clickable { cursor: pointer; }
.loading-content { display: flex; flex-direction: column; align-items: center; text-align: center; color: #fff; text-shadow: 0 0 10px rgba(0,0,0,0.5); z-index: 101; }
#loading-title { font-size: 1.8em; margin: 0; font-weight: normal; }
#loading-percentage { font-size: 1.2em; margin: 20px 0 10px; }
#progress-bar-container {
  width: 300px; max-width: 80%; height: 16px;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50px; box-shadow: 0 4px 30px rgba(0,0,0,0.1);
  padding: 3px; overflow: hidden;
}
#progress-bar { width: 0%; height: 100%; background: linear-gradient(90deg, rgba(255,255,255,0.7), rgba(255,255,255,1)); border-radius: 50px; transition: width .3s ease-out; }
#media-player { display: none; }

/* Analyse-Fenster */
#analysis-window {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; justify-content: center; align-items: center;
  z-index: 200; opacity: 0; pointer-events: none; transition: opacity .3s ease;
}
#analysis-window.visible { opacity: 1; pointer-events: auto; }
.analysis-content {
  position: relative; width: 90%; max-width: 400px; height: 70%; max-height: 600px;
  background: rgba(30,30,30,0.7);
  backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px; padding: 30px; box-sizing: border-box; color: #fff; overflow-y: auto;
  transform: scale(0.95); transition: transform .3s ease;
}
#analysis-window.visible .analysis-content { transform: scale(1); }
#analysis-title { font-size: 1.5em; margin: 0 0 20px; padding-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,0.2); }
#analysis-text-content { font-family: sans-serif; font-size: 1em; line-height: 1.6; margin: 0; }
#close-analysis-button {
  position: absolute; top: 15px; right: 15px; width: 36px; height: 36px;
  background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50%; cursor: pointer; padding: 8px; transition: background-color .2s ease;
}
#close-analysis-button:hover { background: rgba(255,255,255,0.1); }
#close-analysis-button svg { width: 100%; height: 100%; fill: white; }

/* Analyse-Inhalte */
#analysis-text-content img { max-width: 100%; height: auto; border-radius: 12px; display: block; }
#analysis-text-content .analysis-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 12px; }

/* Responsive */
@media (max-width: 768px) {
  #joystick-zone { width: 140px; height: 140px; }
  #bottom-bar { height: 80px; padding: 0 12px; gap: 8px; }
  #analyze-button, #motion-toggle-button { padding: 10px 16px; font-size: 14px; }
  #mute-button { width: 40px; height: 40px; padding: 8px; }
}
